//-----------------------------------------------------
// guientity.h
//-----------------------------------------------------

/**
 * @file guientity.h
 */

#pragma once

#include "logic/entity.h"

namespace nebulaGUI {

	/**
	 * Superclass for graphic representation of all the logic entities of the game
	 *
	 * This class implements the interface logic::CEntity::Observer because this class listen for
	 * the logic object changes.
	 *
	 * Regarding the drawing the render() method must be implemented by it's subclasses depending on
	 * the kind of logic entity we are representing.
	 */

	class NGUIEntity : public logic::CEntity::Observer {

	protected:

		logic::CEntity *logicEntity;	// logic entity being represented
		bool visible;					// Tell if the entity is visible
		float x, y, z;					// Entity position

	public:

		NGUIEntity();
		virtual ~NGUIEntity();

		// Set the logic entity we are representing
		bool setLogicEntity(logic::CEntity *entity);

		// Entity drawing
		virtual bool render() = 0;

		// Set the graphic resource must be called before loadResource()
		virtual bool setResource(const char *nFile) = 0;

		// Load the graphic resource setResource() must be called before
		virtual bool loadResource() = 0;

		// Unload the graphic resource
		virtual void unloadResource() = 0;

		/*******************************/
		/*		OBSERVER METHODS       */
		/*******************************/

		// Method called when the entity position is changed
		virtual void positionChanged(const logic::CEntity *entity, const tools::CVector &pos);

		// Method called when the entity visibility is changed
		virtual void visibilityChanged(const logic::CEntity *entity, bool visibility);

	}; // class NGUIEntity

} // namespace nebulaGUI